<!DOCTYPE html>
<!-- 轮播图 -->
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>轮播图</title>

    <style>
      * {
        margin: 0;
        padding: 0;
      }

      ul,
      ol,
      li {
        list-style: none;
      }

      img {
        width: 100%;
        height: 100%;
        display: block;
      }

      .banner {
        width: 100%;
        height: 500px;
        position: relative;
        margin: 50px 0;
      }

      .banner > ul {
        width: 100%;
        height: 100%;
        position: relative;
      }

      .banner > ul > li {
        width: 100%;
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;

        opacity: 0;

        /* 渐隐、渐显效果 */
        transition: opacity 0.5s linear;
      }

      .banner > ul > li.active {
        opacity: 1;
      }

      .banner > ol {
        width: 200px;
        height: 30px;
        position: absolute;
        bottom: 30px;
        left: 30px;
        background-color: rgba(0, 0, 0, 0.5);

        /* 设置内部样式 */
        display: flex;
        justify-content: space-around;
        align-items: center;
        border-radius: 15px;
      }

      .banner > ol > li {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: #fff;
        cursor: pointer;
      }

      .banner > ol > li.active {
        background-color: orange;
      }

      .banner > div {
        width: 40px;
        height: 60px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background-color: rgba(0, 0, 0, 0.5);

        display: flex;
        justify-content: center;
        align-items: center;
        color: #fff;
        font-size: 30px;
      }

      .banner > div.left {
        left: 0;
      }

      .banner > div.right {
        right: 0;
      }
    </style>
  </head>

  <body>
    <div class="banner">
      <!-- 图片区域 -->
      <!-- ul.imgBox>li*4>img[src="imgs/0$.png"] 通过这种写法，直接生成 -->
      <ul class="imgBox">
        <li class="active"><img src="./imgs/01.png" alt="" /></li>
        <li><img src="./imgs/02.png" alt="" /></li>
        <li><img src="./imgs/03.png" alt="" /></li>
        <li><img src="./imgs/04.png" alt="" /></li>
      </ul>

      <!-- 焦点区域 -->
      <!-- ol>li*4 通过这种写法，直接生成 -->
      <ol>
        <!-- data-XX 可以通过 js 代码中，事件的属性 target.dataset.XX 来获取值 -->
        <li data-i="0" data-name="point" class="active"></li>
        <li data-i="1" data-name="point"></li>
        <li data-i="2" data-name="point"></li>
        <li data-i="3" data-name="point"></li>
      </ol>

      <!-- 左右切换按钮 -->
      <!-- .left 与 .right 通过两种写法，可以直接生成 -->
      <div class="left">&lt;</div>
      <div class="right">&gt;</div>
    </div>

    <script src="./carousel_img.js"></script>
  </body>
</html>
